package com.shenzhen.horselive.adapter;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.flqy.baselibrary.utils.GlideHelper;
import com.shenzhen.horselive.R;
import com.shenzhen.horselive.beans.PayWayBean;
import com.shenzhen.horselive.databinding.DialogInputPassBinding;

import org.jetbrains.annotations.NotNull;

public class PayItemAdapter extends BaseQuickAdapter<PayWayBean.DataBean, BaseViewHolder> {
    private int selection;

    public PayItemAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, PayWayBean.DataBean dataBean) {
        GlideHelper.loadImage(dataBean.getChannelImg(),baseViewHolder.getView(R.id.img_ico));
        baseViewHolder.setText(R.id.tv_pay_name,dataBean.getChannelName())
                .setText(R.id.tv_text,dataBean.getRemark());
        if (baseViewHolder.getAdapterPosition()==selection)
        {

            baseViewHolder.setImageResource(R.id.img_check,R.mipmap.ico_checked);
        }else
        {
            baseViewHolder.setImageResource(R.id.img_check,R.mipmap.ico_un_check);
        }
    }

    public int getSelection() {
        return selection;
    }

    public void setSelection(int selection) {
        this.selection = selection;
        notifyDataSetChanged();
    }
}
